import request from '@/utils/request'

// 用户管理接口
export function getUserList(params) {
  return request({
    url: '/system/user/list',
    method: 'get',
    params
  })
}

export function createUser(data) {
  return request({
    url: '/system/user/create',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/system/user/update',
    method: 'put',
    data
  })
}

export function deleteUser(id) {
  return request({
    url: `/system/user/delete/${id}`,
    method: 'delete'
  })
}

// 角色管理接口
export function getRoleList(params) {
  return request({
    url: '/system/role/list',
    method: 'get',
    params
  })
}

export function createRole(data) {
  return request({
    url: '/system/role/create',
    method: 'post',
    data
  })
}

export function updateRole(data) {
  return request({
    url: '/system/role/update',
    method: 'put',
    data
  })
}

export function deleteRole(id) {
  return request({
    url: `/system/role/delete/${id}`,
    method: 'delete'
  })
}

// 权限管理接口
export function getPermissionList(params) {
  return request({
    url: '/system/permission/list',
    method: 'get',
    params
  })
}

export function createPermission(data) {
  return request({
    url: '/system/permission/create',
    method: 'post',
    data
  })
}

export function updatePermission(data) {
  return request({
    url: '/system/permission/update',
    method: 'put',
    data
  })
}

export function deletePermission(id) {
  return request({
    url: `/system/permission/delete/${id}`,
    method: 'delete'
  })
}

// 部门管理接口
export function getDepartmentList(params) {
  return request({
    url: '/system/department/list',
    method: 'get',
    params
  })
}

export function createDepartment(data) {
  return request({
    url: '/system/department/create',
    method: 'post',
    data
  })
}

export function updateDepartment(data) {
  return request({
    url: '/system/department/update',
    method: 'put',
    data
  })
}

export function deleteDepartment(id) {
  return request({
    url: `/system/department/delete/${id}`,
    method: 'delete'
  })
}